﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections.ObjectModel;
using System.Windows.Input;


namespace MoneyManagerNET.Presentation.ViewModel
{
    using Model;
    using Infrastructure;
    using System.Collections;
    using MoneyManagerNET.Presentation.ViewModel.Base;


    public enum AssetType { };
    public enum ChangeInValue { Appreciate,Deppreciate};

    public class AssetViewModel:ViewModelBase<IAsset>
    {
        public override void LoadValues(IAsset m)
        {
            base.LoadValues(m);
            this.Name = m.Name;
            this.Type = (AssetType)m.AssetType;
            this.Value = m.Value;
            this.Rate = m.Rate;
            this.Date = m.Date;
            this.ChangeInValue = (ChangeInValue)m.ChangeInValue;
            this.Notes = m.Notes;
            OnChange(string.Empty);
        }

        public override IAsset PutValues(IAsset m)
        {
            m= base.PutValues(m);
            m.Name = this.Name;
            m.AssetType = (byte)this.Type;
            m.Value = this.Value;
            m.Rate = this.Rate;
            m.Date = this.Date;
            m.ChangeInValue =(byte) this.ChangeInValue;
            m.Notes = this.Notes;
            return m;
        }

        public ChangeInValue ChangeInValue { get; set; }
        
        public ICollection ChangeInValueTypes { 
            get { return Enum.GetValues(typeof(ChangeInValue)); } 
        }

        public AssetViewModel()
        {
        }

        string _name;
        public string Name { 
            get { return _name; }
            set { _name = value; this.OnChange(()=>Name); } 
        }

        AssetType _Type;
        public AssetType Type { 
            get { return _Type; }
            set { _Type = value; this.OnChange(() => Type); } 
        }

        public ICollection TypeList { get { return Enum.GetValues(typeof(AssetType)); } }

        public DateTime Date { get; set; }

        public Decimal Value { get; set; }

        public double Rate { get; set; }

        public string Notes { get; set; }
    }
}
